public class Main {

    public static void main(String[] args) {
        System.out.println(hammingWeight(3));
    }

    //最长回文子串
    public static int hammingWeight(int n) {
        int count =0;
        while(n!=0){
            if ((n&0x01)==1){
                ++count;
            }
            n=n>>1;
        }
        return count;
    }
}
